#include "tetgenParser.h"
#include "rbrParser.h"
#include "rbrToYafray.h"
#include "newmat.h"
#include "meshTools.h"

using namespace std;
using namespace MeshUtils;
using namespace NEWMAT;


int main(int argc, char* argv[])
{

	if(argc != 2)
	{
		cout << "usage : " << argv[0] << " scene.rbr" << endl;
		exit(0);
	}

    vector<Vector3> nodesTarget;
    vector<Vector3> normalsTarget;
    vector<Vector3> texturesTarget;
    vector<Face_t> facesTarget;
    vector<CameraInfo> camInfo;
    vector<LightInfo> lightInfo;
    std::map<unsigned int, MaterialInfo> materialInfo;
    unsigned int nbNodesTarget;
    unsigned int nbFacesTarget;
    unsigned int nbNormTarget;
    RbrParser rParserTarget(argv[1]);

    rParserTarget.load(nodesTarget, normalsTarget, texturesTarget, facesTarget, camInfo, lightInfo, materialInfo, nbNodesTarget, nbNormTarget, nbFacesTarget);

    RbrUtils::rbrToYafray(nodesTarget, normalsTarget, texturesTarget, facesTarget, camInfo, lightInfo, materialInfo);


/*
    for(unsigned int i = 0 ; i < nodesTarget.size() ; i++)
    {
        cout << "v " << nodesTarget[i].x << " " << nodesTarget[i].y << " " << nodesTarget[i].z << endl;
    }

    for(unsigned int i = 0 ; i < facesTarget.size() ; i++)
    {
        cout << "f " << facesTarget[i].A+2 << " " << facesTarget[i].B+2 << " " << facesTarget[i].C+2 << endl;
    }
*/

	return 0;
}
